from launch import LaunchDescription
from launch_ros.actions import Node
from ament_index_python.packages import get_package_share_directory
import os
import math
def generate_launch_description():
    # 获取包路径
    armor_tracker_pkg = get_package_share_directory('armor_tracker')
    
    # 装甲追踪节点
    armor_tracker_node = Node(
        package='armor_tracker',
        executable='armor_tracker_node',
        name='armor_tracker_node',
        output='screen',
        parameters=[os.path.join(armor_tracker_pkg, 'config', 'armor_tracker.yml')],
    )
    
    # 静态TF变换发布器：odom -> camera_optical_frame
    static_tf_node = Node(
        package='tf2_ros',
        executable='static_transform_publisher',
        name='static_tf_pub',
        arguments=['0', '0', '0', 
                  str(-math.pi/2), '0', str(-math.pi/2),
                  'odom', 'camera_optical_frame']
    )
    
    # 创建launch描述
    return LaunchDescription([
        armor_tracker_node,
        static_tf_node
    ])